<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>[%$softtitle%]</title>
<link href="templates/css/baselist.css" rel="stylesheet" type="text/css" />
<link href="templates/css/all.css" rel="stylesheet" type="text/css" />
<link href="templates/css/formdiv.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/control.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodybottonauto")){
			$('.managebottonadd').css({height:h-40});
		}
	}
	var sitemain_js_sitename_empty  = "[%$ST.sitemain_js_sitename_empty%]";
	var sitemain_js_sitedir_err = "[%$ST.sitemain_js_sitedir_err%]";
	var sitemain_js_sitecode_err = "[%$ST.sitemain_js_sitecode_err%]";
	var sitemain_js_siteip_err = "[%$ST.sitemain_js_siteip_err%]";
	var sitemain_js_sitehttp_err = "[%$ST.sitemain_js_sitehttp_err%]";
	var sitemain_js_adminusername_err = "[%$ST.sitemain_js_adminusername_err%]";
	
	var sitemain_js_edit_ok = "[%$ST.sitemain_js_edit_ok%]";
	var sitemain_js_edit_no = "[%$ST.sitemain_js_edit_no%]";
	var iframename = "[%$iframename%]";
	iframename = iframename=='' ? "jerichotabiframe_0" : iframename;
	$(document).ready(function(){
		var h = '[%$iframeheightwindow%]';
		$('.managebottonadd').css({height:h-40});
		var options = {

			beforeSubmit: formverify,

			success:saveResponse,
			resetForm: true
		}
		$('#formmain').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})




	function formverify(formData) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['sitename']==""){
			document.formmain.sitename.focus();
			alert(sitemain_js_sitename_empty);
			return false;
		}
		if(get['sitehttp'].match(/^http:\/\/[a-zA-Z.0-9/_]+$/ig)==null) {
			document.formmain.sitehttp.focus();
			alert(sitemain_js_sitehttp_err);
			return false;
		}
		if(get['sitedir'].match(/^[\w-]+$/ig)==null) {
			document.formmain.sitedir.focus();
			alert(sitemain_js_sitedir_err);
			return false;
		}
		if(get['sitecode']=="" || get['sitecode'].length<15){
			document.formmain.sitecode.focus();
			alert(sitemain_js_sitecode_err);
			return false;
		}
		if(get['siteip'].match(/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/ig)==null){
			document.formmain.siteip.focus();
			alert(sitemain_js_siteip_err);
			return false;
		}
		if(get['adminusername']==""){
			document.formmain.adminusername.focus();
			alert(sitemain_js_adminusername_err);
			return false;
		}
		parent.windowsdig('Loading','iframe:index.php?archive=management&action=load','400px','180px','iframe',false);
	}
	function saveResponse(options){
		parent.closeifram();
		if (options=='true'){
			parent.frames[iframename].refresh('selectform','selectall','check_all');
			alert(sitemain_js_edit_ok);
		}else{
			alert(sitemain_js_edit_no+options);
		}
		parent.onaletdoc()
	}
</script>
</head>

<body>
<form name="formmain" id="formmain" method="post" action="index.php?archive=sitemain&action=save">
<input type="hidden" name="inputclass" value="edit">
<input type="hidden" name="tab" id="formmaintab" value="[%$tab%]">
<input type="hidden" name="slid" value="[%$read.slid%]">
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">[%$ST.position_title%]</span><span class="colorgorningage">[%$ST.sitemain_edit_mess%]</span></span>
		</div>
		<div class="manageeditdiv">
			<div class="maneditcontent">
				<table class="formtable">
					<tr class="trstyle2">
						<td class="trtitle011">[%$ST.sitemain_add_sitename%]</td>
						<td class="trtitle02"><input type="text" name="sitename" size="30" value="[%$read.sitename%]" maxlength="80" class="infoInput"/> <span class="cautiontitle">[%$ST.sitemain_add_sitename_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">[%$ST.sitemain_add_sitehttp%]</td>
						<td  class="trtitle02"><input type="text" name="sitehttp" value="[%$read.sitehttp%]" size="50" maxlength="100" class="infoInput"/> <span class="cautiontitle">[%$ST.sitemain_add_sitehttp_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">[%$ST.sitemain_add_sitedir%]</td>
						<td class="trtitle02"><input type="text" name="sitedir" size="20" value="[%$read.sitedir%]"  maxlength="20" class="infoInput"/> <span class="cautiontitle">[%$ST.sitemain_add_sitedir_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">[%$ST.sitemain_add_sitecode%]</td>
						<td class="trtitle02"><input type="text" name="sitecode" size="80" value="[%$read.sitecode%]" maxlength="100" class="infoInput"/> <span class="cautiontitle">[%$ST.sitemain_add_sitecode_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">[%$ST.sitemain_add_siteip%]</td>
						<td class="trtitle02"><input type="text" name="siteip" size="20" value="[%$read.siteip%]" maxlength="20" class="infoInput"/> <span class="cautiontitle">[%$ST.sitemain_add_siteip_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">[%$ST.sitemain_add_adminusername%]</td>
						<td class="trtitle02"><input type="text" name="adminusername" size="20" value="[%$read.adminusername%]" maxlength="50" class="infoInput"/> <span class="cautiontitle">[%$ST.sitemain_add_adminusername_mess%]</span></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr>
				<td id="right"><input type="submit" id="submitbotton" name="Submit" value="[%$ST.botton_edit%]" class="button orange" /></td>
				<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="[%$ST.botton_edit_reset%]" class="button orange" /></td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>

</html>      